package com.rm.zeyou.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.rm.zeyou.entity.Technician;
import com.rm.zeyou.response.ApiRestResponse;
import com.rm.zeyou.service.CityFareGlobalConfigService;
import com.rm.zeyou.util.login.TechnicianLoginUtil;
import com.rm.zeyou.vo.response.TechnicianFreeIndexResponseVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.text.ParseException;

/**
 * <p>
 * 城市路费全局配置表 前端控制器
 * </p>
 *
 * @author YanYang
 * @since 2025-03-12 15:55:07
 */
@Api(tags = "车费相关")
@RestController
@RequestMapping("/api/cityFareGlobalConfig")
public class CityFareGlobalConfigController {
    @Resource
    private CityFareGlobalConfigService cityFareGlobalConfigService;
    @Resource
    private TechnicianLoginUtil technicianLoginUtil;

    @ApiOperation(value = "技师免车费页面")
    @PostMapping("technicianFreeIndex")
    @SaCheckLogin(type = "technician")
    public ApiRestResponse<TechnicianFreeIndexResponseVo> technicianFreeIndex() throws ParseException {
        Technician technician = technicianLoginUtil.getTechnician();
        return cityFareGlobalConfigService.technicianFreeIndex(technician);
    }

}
